package bishi.day14_5_10;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 幸运的袋子
 * @author 是阿秋啊
 * @date 2022/05/22 18:59
 **/
public class Lucky_bag {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        int num = helper(arr,0,0,1);
        System.out.println(num);
    }

    private static int helper(int[] arr, int index, int sum, int multi) {
        int count = 0;
        for (int i = index; i < arr.length; i++) {
            sum+=arr[i];
            multi*=arr[i];
            if (sum > multi) {
                count = count + 1 + helper(arr,i+1,sum,multi);
            }else if (arr[i] == 1) {
                count = count + helper(arr,i+1,sum,multi);
            }else {
                break;
            }
            sum-=arr[i];
            multi/=arr[i];
            while (i < arr.length - 1 && arr[i] == arr[i+1]) {
                i++;
            }
        }
        return count;
    }
}